package com.sky.cloudbabaapplication.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Value("${server.port}")
    private String port;

    @Resource
    private RestTemplate restTemplate;

    @RequestMapping("test")
    public String test(){
        return "test,port="+port;
    }

    @RequestMapping("port")
    public String getPort(){
        return restTemplate.getForObject("http://service1/test",String.class);
    }
}
